import random

n = random.randint(1,1000)
m = int(input("请猜数："))
count = 1
while m != n:
    if m > n:
        print("猜大了！", end='')
        m = int(input("请猜数："))
    else:
        print("猜小了！", end='')
        m = int(input("请猜数："))
    count += 1
print("猜对了！共猜了{}次".format(count))
